<template>
  <div>
    <van-row
      style="height: 350px; line-height: 350px; color: aqua; font-size: 30px">
      <van-col span="24"> TT24H自助洗车 </van-col>
    </van-row>
    <van-row>
      <van-col span="24">
        <van-cell-group>
          <van-field
            v-model="userName"
            label="手机号"
            placeholder="请输入手机号" />
          <van-field
            label-class="phone-input"
                v-model="passWord"
                right-icon="eye"
                :type="!passwordStatus?'password':'text'"
                name="密码"
                label="密码"
                @click-right-icon="passwordStatus=!passwordStatus"
                placeholder="请输入密码" />
        </van-cell-group>
      </van-col>
    </van-row>

    <van-row style="margin-top: 15px; font-size: 13px">
      <van-col span="8" style="text-align: left; margin-left: 15px">
        <a @click="jump('register')">注册 </a>
      </van-col>
      <van-col span="6"></van-col>
      <van-col span="8" style="text-align: right">
        <a @click="jump('pass')">忘记密码 </a>
      </van-col>
    </van-row>

    <van-button
      round
      type="info"
      style="margin-top: 10px; width: 80%"
      @click="logon"
      >登录</van-button
    >
    <div class="flass">
      <div class="bottom">
        <!-- <p>登陆及表示您同意<span>《平价驻车用户隐私协议》</span></p> -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      passWord: "",
      userName: "",
      passwordStatus:'',
    };
  },
  methods: {
    jump(uri) {
      this.$router.push(uri);
    },
    //登录
    logon() {
      var _this = this;
      console.log("登录。。。。。。。。。。。。");
      if (this.userName == "") {
        _this.$message.error("账号不能为空！");
        return;
      } else if (this.passWord == "") {
        _this.$message.error("密码不能为空！");
        return;
      }
      //用户登录
      this.$http
        .get(
          "/TuserA/login?mobile=" +
            this.userName +
            "&password=" +
            this.passWord
        )
        .then(function (response) {
          if (response.data.code == 200) {
            // alert("登录成功！token:"+response.data.data);
            //向本地存储对象存入token
            localStorage.setItem("token", response.data.data);
            _this.jump("/");
          } else {
            _this.$message.error("账号或者密码错误");
          }
        })
        .catch(function (error) {
          console.log(error);
          _this.$message.error("你错了。。。");
        });
    },
  },
};
</script>

<style>
.nav_spj {
  height: 350px;
  background-color: aqua;
}
</style>
